home *** CD-ROM | disk | FTP | other *** search
- /* Cannonical Ising Model, by an idea of Toffoli, in CAMRexx by THOR */
-
-
- MakeAlgorithm:
- if plane=2 then
- PLANEALGORITHM neumann hvpc
- else
- PLANEALGORITHM margolus hvphases
- return
-
- MakePlane:
- /* Random generator in planes 0..1 */
- /* Please note that the "Neumann-hvpc" algorithm has a different
- naming convention... see the docs. */
- if plane=0 then; do
- if center=opp & cw=ccw & center~=cw then
- SETPLANE cw
- else SETPLANE opp
- end
- if plane=1 then; do
- if center=opp & cw=ccw & center~=cw then
- SETPLANE center
- else; do
- if phase then SETPLANE cw
- else SETPLANE ccw
- end
- end
- /* Ising-model in plane 2 */
- if plane=2 then; do
- lattice=(horz=vert)
- if phase=1 then lattice=~lattice
- /* handle only even or odd sublattice */
- if lattice then; do
- /* calculate bond energy of the spin */
- bonds=north+south+east+west
- if center then
- bonds=4-bonds
- /* simple random value */
- p=alt
- /* squared */
- p2=alt & alt_
- /* and now the new spin-value */
- new=center
- select
- when bonds=0 then; do
- if p2 then new=~new /* flip */
- end
- when bonds=1 then; do
- if p then new=~new /* flip */
- end
- otherwise
- new=~new
- end
- SETPLANE new
- end; else; do;
- SETPLANE center
- end
- end
- return
-
-